package com.ruiyian.eventnetty;

import com.ruiyian.common.core.redis.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * 监听Spring容器启动完成，完成后启动Netty服务器
 * @author Gjing
 **/
@Component
public class NettyStartListener implements ApplicationRunner {
    @Autowired
    private RedisCache redisCache;

    @Resource
    private SocketServer socketServer;

    @Override
    public void run(ApplicationArguments args) throws Exception {
//        this.socketServer.start();
        HashMap<String, Integer> neweventhashMap = new HashMap<>();
        neweventhashMap.put("eventflag", 0);
        redisCache.setCacheObject("eventdic", neweventhashMap);
    }
}
